name: Analyze
on:
  push:
  pull_request:
  schedule:
    - cron: '30 7 * * 1'
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  codeql:
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Install dependencies
      run: |
        sudo scripts/auto install-build-deps

    - name: Initialize CodeQL
      uses: github/codeql-action/init@v1
      with:
        languages: cpp, python
        queries: +security-and-quality

    - name: Autobuild
      uses: github/codeql-action/autobuild@v1

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v1

  flake8:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Install flake8
      run: |
        sudo apt update
        sudo apt install -y flake8

    - name: Execute flake8 on the repository
      run: flake8 --ignore=W503,E501 src/compat/authcompat.py.in.in .
